package com.asiainfo.util;

/**
 * 根据时间方式获取Sequence便于数据库操作
 * 
 */


public class DBSequence {
	
	private static DBSequence _oSeqGenerator;
	private long _lID;

	private DBSequence() {
		_lID = 0;
	}

	public final static synchronized DBSequence getInstance() {
		if (_oSeqGenerator == null) {
			_oSeqGenerator = new DBSequence();
		}
		return _oSeqGenerator;
	}
    public synchronized String getSequence(){
	    _lID++;
		long lCurTime_ = System.currentTimeMillis() - 1000000000;
		long lTempID_ = _lID + lCurTime_;
	    return Long.toString(lTempID_);
    }

	public static void main(String args[]){
		System.out.println(DBSequence.getInstance().getSequence());

	}
}